package eu.boss.controller;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import eu.boss.model.StatsMessage;

/**
 * Service used as a MVC controller
 * 
 * @author Arnaud
 * 
 */
public class ShadowStatsController extends Service {
	/**
	 * @param mBinder
	 * @param mPlayers
	 *            playerList
	 */
	private final IBinder mBinder = new LocalBinder();
	private StatsMessage mStatsMessage;
	private String mHash;

	/**
	 * Class used for the client Binder. Because we know this service always
	 * runs in the same process as its clients, we don't need to deal with IPC.
	 */
	public class LocalBinder extends Binder {
		public ShadowStatsController getService() {
			// Return this instance of LocalService so clients can call public
			// methods
			return ShadowStatsController.this;
		}
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return mBinder;
	}

	public String getHash() {
		return mHash;
	}

	public void setHash(String hash) {
		this.mHash = hash;
	}

	public StatsMessage getStatsMessage() {
		if (mStatsMessage == null) {
			mStatsMessage = new StatsMessage("");
		}
		return mStatsMessage;
	}

	public void setStatsMessage(StatsMessage statsMessage) {
		this.mStatsMessage = statsMessage;
	}

}
